﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;

public partial class MemberImage : System.Web.UI.Page {

    protected void Page_Load(object sender, EventArgs e) {

        string memberId = Request["memberId"];
        if (String.IsNullOrEmpty(memberId))
            return;

        // load the image
        BadHabit.Factory.Data.TeamDataSet dsTeam = new BadHabit.Factory.Data.TeamDataSet();
        BadHabit.Factory.Data.TeamDataSetTableAdapters.MemberAvatarTableAdapter memberAvatarTA = new BadHabit.Factory.Data.TeamDataSetTableAdapters.MemberAvatarTableAdapter();
        memberAvatarTA.FillByMemberId(dsTeam.MemberAvatar, memberId);

        if (dsTeam.MemberAvatar.Rows.Count == 0)
            return;

                
        // and return it as a PNG file
        Response.ContentType = "image/png";
        Response.BinaryWrite(dsTeam.MemberAvatar[0].MemberImage);            
        
    }


    
}
